package de.ttf.ts.control.impl;

import java.util.Collection;
import java.util.HashSet;

import de.ttf.ts.control.ClubController;
import de.ttf.ts.control.impl.dao.ClubDao;
import de.ttf.ts.model.Club;
import de.ttf.ts.model.EntityInfo;
import de.ttf.ts.model.Person;

public class ClubControllerImpl extends AbstractController implements ClubController {

    private ClubDao clubDao;

    @Override
    public void saveClub(EntityInfo<Club> info, String name, EntityInfo<Person> contactPerson) {
        Club club = findOrCreate(Club.class, clubDao, info);
        club.setName(name);
    }

    @Override
    public Collection<Club> getClubs() {
        return new HashSet<Club>(clubDao.findClubsPlayers());
    }

    public void setClubDao(ClubDao clubDao) {
        this.clubDao = clubDao;
    }

}
